<!-- Initial screen till static information was put in -->
<div ng-if="!master.current.loaded">
  <form role="form">
    <div class="row" ng-if="master.current.error">
      <div class="alert alert-danger">{{master.current.error}}</div>
    </div>
    <div class="row">
      <div class="col-xs-12 col-md-6">
        <div class="form-group">
          <label>JIRA base url:</label>
          <input type="text" class="form-control" placeholder="http://jira.atlassian.net" ng-model="master.current.base_url">
        </div>
      </div>
      <div class="col-xs-12 col-md-6">
        <div class="form-group">
          <label>Project</label>
          <input type="text" class="form-control" placeholder="MYPROJECT" ng-model="master.current.project">
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-xs-12 col-md-6">
        <div class="form-group">
          <label>Username:</label>
          <input type="text" class="form-control" placeholder="username" ng-model="master.current.username">
        </div>
      </div>
      <div class="col-xs-12 col-md-6">
        <div class="form-group">
          <label>Password</label>
          <input type="password" class="form-control" placeholder="password" ng-model="master.current.password">
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-xs-12 col-md-6">
        <div class="form-group">
          <label>JQL</label>
          <input type="text" class="form-control" placeholder="JQL EXAMPLE TODO" ng-model="master.current.jql">
        </div>
      </div>
    </div>
    <button class="btn btn-default" ng-click="master.current.load()">Load issues</button>
  </form>
</div>

<!-- Screen after static process was completed -->
<div ng-if="master.current.loaded">
  <div class="row form-group">
    <div class="col-xs-6 col-xs-offset-3 col-md-6 col-md-offset-3">
      <button class="btn btn-default btn-block" ng-click="master.current.reload()" ga-track-event="master.current.event">Reload</button>
    </div>
  </div>
  <div class="row">
    <div class="col-xs-4">
      <div class="list-group issue-list">
        <a  ng-repeat="issue in master.current.issues track by issue.id" class="selectable list-group-item" ng-class="{active: master.current.issue == issue}" ng-click="master.current.issue = issue">
          {{ issue.key }}: {{ issue.fields.summary }}
        </a>
      </div>
    </div>
    <div class="col-xs-8">
      <div class="row">
        <div class="col-xs-1">
          <img src="{{ master.current.issue.fields.creator.avatarUrls['48x48'] }}" alt="{{ master.current.issue.field.creator.displayName }}" />
        </div>
        <div class="col-xs-11">
          <h2><a href="{{ master.current.base_url }}/browse/{{ master.current.issue.key }}" target="_blank">{{ master.current.issue.key }}</a>: {{ master.current.issue.fields.summary }}</h2>
        </div>
      </div>

      <div class="panel panel-default">
        <div class="panel-heading">
          {{ master.current.issue.fields.creator.displayName }} created issue on {{ master.current.issue.fields.created | date : "medium" }}
        </div>
        <div class="panel-body" style="white-space: pre-line" ng-bind-html="master.current.issue.fields.description"></div>
      </div>

      <button class="btn btn-default" ng-click="master.startPoll(master.current.issue.key + ' ' + master.current.issue.fields.summary, master.current.issue.fields.description, master.current.base_url + '/browse/' + master.current.issue.key)">Start</button>
    </div>
  </div>
</div>
